var tecCardID = GetQueryString("id");
var sentMessage = {
    "requestType": "initInfoFromTec",
    "tech_id": tecCardID
};
var tecCardData;
$.ajax({
    url: '/task/checkTecCard',
    type: 'post',
    data: sentMessage,
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            tecCardData = data;
        }

    },
    error: function (data, status) {
        if (status == 'error') {
            alert("你的网络有问题！");
        }
    }
});
console.log(tecCardData);
document.getElementById('shenheyijian').innerText = tecCardData[0].tech_reason
document.getElementById("task_product").value = tecCardData[0].task_product;
document.getElementById("task_pname").value = tecCardData[0].task_pname;
document.getElementById("task_opportunity").value = tecCardData[0].task_opportunity;
document.getElementById("wc_pipeName").value = tecCardData[0].wc_pipeName;
document.getElementById("wc_spec").value = tecCardData[0].wc_spec;
document.getElementById("wc_scale").value = tecCardData[0].wc_scale;
document.getElementById("task_standard").value = tecCardData[0].task_standard;
document.getElementById("wc_qua").value = tecCardData[0].wc_qua;

document.getElementById("tech_version").value = tecCardData[0].tech_version;
document.getElementById("task_type").value = tecCardData[0].wc_type;
document.getElementById("wc_weldM").value = tecCardData[0].wc_weldM;
document.getElementById("wc_texture").value = tecCardData[0].wc_texture;
document.getElementById("tech_screen").value = tecCardData[0].tech_screen;
document.getElementById("tech_filmBrand").value = tecCardData[0].tech_filmBrand;
document.getElementById("tech_devTime").value = tecCardData[0].tech_devTime;
document.getElementById("tech_devT").value = tecCardData[0].tech_devT;

document.getElementById("tech_ray").value = tecCardData[0].tech_ray;
document.getElementById("tech_focus").value = tecCardData[0].tech_focus;
document.getElementById("tech_IQIV").value = tecCardData[0].tech_IQIV;
document.getElementById("tech_filmV").value = tecCardData[0].tech_filmV;
document.getElementById("tech_devCondition").value = tecCardData[0].tech_devCondition;
document.getElementById("tech_liquor").value = tecCardData[0].tech_liquor;
document.getElementById("tech_focalDis").value = tecCardData[0].tech_focalDis;
document.getElementById("tech_seg").value = tecCardData[0].tech_seg;

document.getElementById("tech_tranLen").value = tecCardData[0].tech_tranLen;
document.getElementById("tech_IQISen").value = tecCardData[0].tech_IQISen;
document.getElementById("tech_V").value = tecCardData[0].tech_V;
document.getElementById("tech_time").value = tecCardData[0].tech_time;
document.getElementById("task_standard").value = tecCardData[0].task_standard;

function OnCommit() {
    var date = new Date();
    sentMessage = {
        "tech_version": document.getElementById("tech_version").value,
        "tech_pid": tecCardData[0].tech_pid,
        "tech_tid": tecCardData[0].tech_tid,
        "tech_wcid": tecCardData[0].tech_wcid,
        "tech_screen": document.getElementById("tech_screen").value,
        "tech_filmBrand": document.getElementById("tech_filmBrand").value,
        "tech_devTime": document.getElementById("tech_devTime").value,
        "tech_devT": document.getElementById("tech_devT").value,
        "tech_ray": document.getElementById("tech_ray").value,
        "tech_focus": document.getElementById("tech_focus").value,
        "tech_IQIV": document.getElementById("tech_IQIV").value,
        "tech_filmV": document.getElementById("tech_filmV").value,
        "tech_devCondition": document.getElementById("tech_devCondition").value,
        "tech_liquor": document.getElementById("tech_liquor").value,
        "tech_focalDis": document.getElementById("tech_focalDis").value,
        "tech_seg": document.getElementById("tech_seg").value,
        "tech_tranLen": document.getElementById("tech_tranLen").value,
        "tech_IQISen": document.getElementById("tech_IQISen").value,
        "tech_V": document.getElementById("tech_V").value,
        "tech_time": document.getElementById("tech_time").value,
        "tech_tranType": document.getElementById("tech_tranType").value,
        "tech_date": date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(),
        "tech_id": tecCardID,
        "requestType": "updateTechTable"
    };
    console.log(JSON.stringify(sentMessage));
    $.ajax({
        url: '/task/checkTecCard',
        type: 'post',
        data: sentMessage,
        async: false,
        success: function (data, status) {
            if (status == 'success') {
                alert("提交成功");
                history.back();
            }

        },
        error: function (data, status) {
            if (status == 'error') {
                alert("你的网络有问题！");
            }
        }
    });
}
function OnBack() {
    window.location.href = document.referrer
}